#!/usr/bin/python3
# coding=utf-8
import openai
from args import *


client = openai.Client(
    api_key="cannot be empty",
    base_url=f"{xinference_url}:{xinference_port}/v1"
)


def chat_model(prompt, model_uid=model_uid, max_tokens=2048, temperature=0.8):
    response = client.chat.completions.create(
        model=model_uid,
        messages=[
            {
                "content": prompt,
                "role": "user",
            }
        ],
        max_tokens=max_tokens,
        temperature=temperature
    )
    return response.choices[0].message.content




if __name__ == '__main__':
    for i in range(10):
        print(chat_model("你好"))